package com.example.demo.Service;

import com.example.demo.Dao.UserDao;
import com.example.demo.Entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired
    UserDao userDao;

    public Integer getUserU_id(String username) {
        return userDao.getUserU_id(username);
    }

    public User getUserByUsername(String username) {
        return userDao.getUserByUsername(username);
    }

    public User getUser(String username) {
        return userDao.getUser(username);
    }

    public Integer setUser(User user) {
        return userDao.setUser(user);
    }

    public Integer setAdmin(User user) {
        return userDao.setAdmin(user);
    }

    public Integer setEmployee(User user) {
        return userDao.setEmployee(user);
    }


    public List<User> selectUser(String name) {
        return userDao.selectUser(name);
    }

    public User getUserByid(Integer id, Integer r_id) {
        return userDao.getUserByid(id, r_id);
    }

    public User updateUserByid(User user) {
        return userDao.updateUserByid(user);
    }

    public User updateAdminByid(User user) {
        return userDao.updateAdminByid(user);
    }

    public User updateEmployeeByid(User user) {
        return userDao.updateEmployeeByid(user);
    }

    public List<User> getAllUser() {
        return userDao.getAllUser();
    }

    public Integer getUserR_id(String username) {
        return userDao.getUserR_id(username);
    }

    public List<User> getAllemployee() {
        return userDao.getAllemployee();
    }

    public List<User> getUserBystr(String name) {
        return userDao.getUserBystr(name);
    }

    public int updateEmployeePassword(Integer id, String password) {
        return userDao.updateEmployeePassword(id, password);
    }

    public int updateUserPassword(Integer id, String password) {
        return userDao.updateUserPassword(id, password);
    }

    public Integer countUser() {
        return userDao.countUser();
    }

    public Integer countAdmin() {
        return userDao.countAdmin();
    }

    public Integer countEmployee() {
        return userDao.countEmployee();
    }
}
